<template>
	<!-- 核销详情writedetails -->
	<view class="w_wp">
		<view class="w_info">
			<view class="w_name">
				<text>会员：{{info.nickname}}</text>
				<text>下单：{{info.createtime}}</text>
			</view>
			<view class="w_order">
				{{info.ordersn}}
			</view>
			<view class="w_li">
				<image :src="info.thumb" mode=""></image>
			</view>
			<view class="w_li">
				<text class="goods_title">{{info.goodstitle}}</text>
			</view>
			<view class="w_li">
				<text>商品数量：</text>
				<text>{{info.total}}</text>
			</view>
			<view class="w_li">
				<text>商品价格：</text>
				<text>{{info.price}}</text>
			</view>
			<view class="w_li">
				<text>现金收入：</text>
				<text class="w_money">{{info.buyprice}}</text>
			</view>
			<view class="w_li">
				<text>米券收入：</text>
				<text class="w_money">{{info.creditprice}}</text>
			</view>
		</view>
		<view class="w_bottom" @click="onsubmit">
			确认核销
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				content: '',
				sig: '',
				info: {}
			}
		},
		onLoad(option) {
			// #ifdef H5
			this.$navTo('/pages/individualism/user');
			return;
			// #endif
			this.content = option.content;
			this.sig = option.sig;
			this.getinfo();
		},
		methods: {
			onsubmit() {
				var that = this;
				uni.showModal({
					title: '确认核销?',
					success(res) {
						if (res.confirm) {
							that.$axios('order/dh', 'POST', 'supplier', {
								content: that.content,
								sig: that.sig
							}).then(res => {
								if (res.data.code == 200) {
									that.$api.msg('核销成功！');
									setTimeout(() => {
										that.$navRed('/pages/business/exchangeorder?status=3')
									}, 1000)
								}
							})
						}
					}
				})
			},
			getinfo() {
				this.$axios('order/getDHInfo', 'POST', 'supplier', {
					content: this.content,
					sig: this.sig
				}).then(res => {
					if (res.data.code == 200) {
						this.info = res.data.data;
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #f2f2f2;
	}

	.w_wp {
		color: $font-color-dark;
		padding-bottom: 130upx;
	}

	.w_info {
		background-color: #fff;
		padding: 20upx;
	}

	.w_name,
	.w_order {
		line-height: 80upx;
	}

	.w_name {
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.w_order {
		font-weight: bold;
		font-size: 34upx;
		text-align: center;
	}

	.w_money {
		color: $base-color;
	}

	.w_li {
		text-align: center;
		font-weight: bold;
		line-height: 60upx;
	}

	.w_li image {
		height: 120upx;
		width: 120upx;
	}

	.goods_title {
		display: inline-block;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		width: 80%;
	}

	.w_bottom {
		background: $base-color;
		border-radius: 10upx;
		color: #fff;
		margin: 40upx 0;
		line-height: 70upx;
		letter-spacing: 1px;
		text-align: center;
	}
</style>
